
pacman::p_load(lubridate,
               tidyverse,
               readxl,
               doParallel,
               foreach,
               tictoc
)



# Modify ------------------------------------------------------------------
# The bracket identifies the initialization code block to that it can be run with CMD + Enter
{
  PATH_WD <- "/projects/Credit_Scoring_ML_MeursaultMoultonSantucci/GitLab/meursault_credit_scoring_ml/"
  setwd(PATH_WD)
  
  RAND_NO_CID <- 0:9 %>% 
    paste(.) %>% 
    str_pad(., 4, "left", 0)
  
  CONSUMER_GROUP <- c("CC", "CD")

  
  LLH_COND <- TRUE
  
  df_rolling_window <- read_xlsx("../../data/rolling_window.xlsx") %>% 
    select(train_start, train_end, test_start, test_end) %>% 
    mutate(
      across(
        .cols = everything(), ~ as_date(.)
      )
    )
  
  V_TRAINING_START_QTR <- df_rolling_window$train_start
  V_TRAINING_END_QTR <- df_rolling_window$train_end
  
  V_TEST_START_QTR <- df_rolling_window$test_start
  V_TEST_END_QTR <- df_rolling_window$test_end
  
  NUM_MODELS <- nrow(df_rolling_window)
  
  SPECIAL_SUFFIX <- paste0("r_and_r_", str_flatten(CONSUMER_GROUP, collapse = "_"))
  
  MODEL_METRIC <- "roc_auc" # "roc_auc" "pr_auc", "accuracy"
  
  V_POTENTIAL_MODELS <- c("xgb", "logistic", "riskscore") # c("xgb", "logistic", "riskscore")
  DF_DATA_DICTIONARY <- read_xlsx("../../data/CCP Table 2 Data Dictionary.xlsx") %>% 
    select(`Variable Name`, Description)
  
  
  # DO NOT MODIFY -----------------------------------------------------------
  
  Remove_Non_Hyperparameters <- function() {
    
    v_objects_all <- setdiff(ls(envir = globalenv()), c("Remove_Non_Hyperparameters", "Source_And_Remove_Non_Hyperparameters"))
    v_objects_to_keep <- str_to_upper(v_objects_all) == v_objects_all
    rm(list = v_objects_all[!v_objects_to_keep], envir = globalenv())
  }
  
  Source_And_Remove_Non_Hyperparameters <- function(r_script) {
    
    source(r_script, local = TRUE)
    Remove_Non_Hyperparameters()
    
  }
  
  Check_Hyperparameters <- function() {
    
    for(i in 1:NUM_MODELS) {
      
      print(paste("Checking Hyperparameters for model", i))
      
      TRAINING_START_QTR <- V_TRAINING_START_QTR[i]
      TRAINING_END_QTR <- V_TRAINING_END_QTR[i]
      TEST_START_QTR <- V_TEST_START_QTR[i]
      TEST_END_QTR <- V_TEST_END_QTR[i]
      
      b_training_date <- TRAINING_START_QTR <= TRAINING_END_QTR
      b_test_date <- TEST_START_QTR <= TEST_END_QTR
      b_test_date_after_training_date <- TRAINING_END_QTR < TEST_START_QTR
      
      
      training_start_day <- day(TRAINING_START_QTR)
      training_start_month <- month(TRAINING_START_QTR)
      
      training_end_day <- day(TRAINING_END_QTR)
      training_end_month <- month(TRAINING_END_QTR)
      
      test_start_day <- day(TEST_START_QTR)
      test_start_month <- month(TEST_START_QTR)
      
      test_end_day <- day(TEST_START_QTR)
      test_end_month <- month(TEST_END_QTR)
      
      v_months <- c(3, 6, 9, 12)
      
      stopifnot("TRAINING_START_QTR is not before TRAINING_END_QTR" = b_training_date)
      stopifnot("TEST_START_QTR is not before TEST_END_QTR" = b_test_date)  
      stopifnot("TEST_START_QTR is before TRAINING_END_QTR" = b_test_date_after_training_date)
      
      stopifnot("TRAINING_START_QTR day is not 1" = training_start_day == 1)
      stopifnot("TRAINING_END_QTR day is not 1" = training_end_day == 1)
      stopifnot("TEST_START_QTR day is not 1" = test_start_day == 1)
      stopifnot("TEST_END_QTR day is not 1" = test_end_day == 1)
      
      
      stopifnot("TRAINING_START_QTR month is not 3, 6, 9, or 12" = training_start_month %in% v_months)
      stopifnot("TRAINING_END_QTR month is not 3, 6, 9, or 12" = training_end_month %in% v_months)
      stopifnot("TEST_START_QTR month is not 3, 6, 9, or 12" = test_start_month %in% v_months)
      stopifnot("TEST_END_QTR month is not 3, 6, 9, or 12" = test_end_month %in% v_months)
      
    }
    
    length_V_TRAINING_START_QTR <- length(V_TRAINING_START_QTR)
    length_V_TRAINING_END_QTR <- length(V_TRAINING_END_QTR)
    length_V_TEST_START_QTR <- length(V_TEST_START_QTR)
    length_V_TEST_END_QTR <- length(V_TEST_END_QTR)
    
    b_training_start_training_end <- length_V_TRAINING_START_QTR == length_V_TRAINING_END_QTR
    b_training_end_test_start <- length_V_TRAINING_END_QTR == length_V_TEST_START_QTR
    b_test_start_test_end <- length_V_TEST_START_QTR == length_V_TEST_END_QTR
    
    v_acceptable_metrics <- c("roc_auc", "accuracy", "pr_auc")
    
    
    num_4_char_IDS <- (map_dbl(RAND_NO_CID, ~ nchar(.)) == 4) %>% sum()
    
    
    b_IDS <- num_4_char_IDS == length(RAND_NO_CID)
    
    stopifnot("rand no cids are not all 4 characters long" = b_IDS)  
    stopifnot("MODEL_METRIC is not an acceptable metric" = MODEL_METRIC %in% v_acceptable_metrics)
    
    stopifnot("The number of training starting qtrs differs from the number of training ending qtrs" = b_training_start_training_end) 
    stopifnot("The number of training ending qtrs differs from the number of test starting qtrs" = b_training_end_test_start) 
    stopifnot("The number of test starting qtrs differs from the number of test ending qtrs" = b_test_start_test_end)
    
    
  }
  
  Check_Hyperparameters()
  
  RAND_NO_CID_SMALLEST_LARGEST <- paste(RAND_NO_CID[1], 
                                        RAND_NO_CID[length(RAND_NO_CID)], sep = "_")
}


Source_And_Remove_Non_Hyperparameters("src/01_data_prep/01_pull_data.R")
Source_And_Remove_Non_Hyperparameters("src/01_data_prep/02_create_outcome_and_remove_deceased.R")
Source_And_Remove_Non_Hyperparameters("src/01_data_prep/03_get_open_accounts_counts.R")
Source_And_Remove_Non_Hyperparameters("src/02_ml_pipeline/01_generate_cid_qtr_table.R")

# Loop 1: data descriptions, training set and vi  ------------------------------------------------

for(i in 1:NUM_MODELS) {
  
  print(paste("Running model", i))
  
  TRAINING_START_QTR <- V_TRAINING_START_QTR[i]
  TRAINING_END_QTR <- V_TRAINING_END_QTR[i]
  TEST_START_QTR <- V_TEST_START_QTR[i]
  TEST_END_QTR <- V_TEST_END_QTR[i]
  
  TRAINING_SUFFIX <- paste0("Train",
                            year(ymd(TRAINING_START_QTR)),
                            "Q", quarter(ymd(TRAINING_START_QTR)),
                            year(ymd(TRAINING_END_QTR)),
                            "Q",
                            quarter(ymd(TRAINING_END_QTR)))
  
  TEST_SUFFIX <- paste0("Test",
                        year(ymd(TEST_START_QTR)),
                        "Q", quarter(ymd(TEST_START_QTR)),
                        year(ymd(TEST_END_QTR)),
                        "Q", quarter(ymd(TEST_END_QTR)))
  
  SUFFIX_FITTED_ <- paste0(TRAINING_SUFFIX, "_", TEST_SUFFIX, "_", RAND_NO_CID_SMALLEST_LARGEST, "_", MODEL_METRIC)
  
  # Generating Folders ------------------------------------------------------
  
  Create_Folders <- function() {
    
    if (!dir.exists(SPECIAL_SUFFIX)) {

      dir.create(paste0("../../data/pipeline_outputs/", SPECIAL_SUFFIX))


    }
    
    path <- paste0("../../data/pipeline_outputs/")
    
    path_special_suffix <- paste0(path, SPECIAL_SUFFIX, "/")
    
    if (!dir.exists(path_special_suffix)) {

      dir.create(path_special_suffix)

    }

    path_train <- paste0(path_special_suffix, "train_", TRAINING_SUFFIX, "_", RAND_NO_CID_SMALLEST_LARGEST, "/")

    if (!dir.exists(path_train)) {

      dir.create(path_train)

    }
    
    path_smbinning <- paste0(path_special_suffix, "smbinning_", TRAINING_SUFFIX,
                                       "_", RAND_NO_CID_SMALLEST_LARGEST, "/")
    

    path_lasso_selected_vars <- paste0(path_special_suffix, "lasso_selected_vars_", TRAINING_SUFFIX,
                                       "_", RAND_NO_CID_SMALLEST_LARGEST, "/")

    if (!dir.exists(path_smbinning)) {

      dir.create(path_smbinning)
    }
    
    if (!dir.exists(path_lasso_selected_vars)) {
      
      dir.create(path_lasso_selected_vars)
    }
    
    
    path_plots <- paste0(path_special_suffix, "plots_", SUFFIX_FITTED_, "/")

    if (!dir.exists(path_plots)) {

      dir.create(path_plots)
      dir.create(paste0(path_special_suffix, "plots_combined/"))
    }

    path_tables <- paste0(path_special_suffix, "tables/")

    if (!dir.exists(path_tables)) {

      dir.create(path_tables)
    }

    path_train_binned <- paste0(path_special_suffix, "train_binned_", TRAINING_SUFFIX, "_", RAND_NO_CID_SMALLEST_LARGEST, "/")

    if (!dir.exists(path_train_binned)) {

      dir.create(path_train_binned)

    }

    path_threshold_inputs <- paste0("../../data/pipeline_outputs/", SPECIAL_SUFFIX,
                                    "/", "threshold_inputs_", TRAINING_SUFFIX,
                                    "_", RAND_NO_CID_SMALLEST_LARGEST, "_", MODEL_METRIC, "/")

    if (!dir.exists(path_threshold_inputs)) {

      dir.create(path_threshold_inputs)
      dir.create(paste0(path_special_suffix, "threshold_inputs_combined/"))

    }

    path_merged_census_fitted <- paste0(path_special_suffix, "fitted_merged_", SUFFIX_FITTED_, "/")


    if (!dir.exists(path_merged_census_fitted)) {

      dir.create(path_merged_census_fitted)
      dir.create(paste0(path_special_suffix, "fitted_merged_combined/"))
    }

    path_merged_census_fitted_training <- paste0(path_special_suffix, "fitted_merged_training_", TRAINING_SUFFIX,
                                                 "_", RAND_NO_CID_SMALLEST_LARGEST, "_", MODEL_METRIC, "/")


    if (!dir.exists(path_merged_census_fitted_training)) {

      dir.create(path_merged_census_fitted_training)
      dir.create(paste0(path_special_suffix, "fitted_merged_training_combined/"))
    }




    v_models <- c("riskscore", "logistic", "xgb")

    for (model_ in v_models) {


      path_fitted <- paste0(path_special_suffix, "fitted_", model_, "_", SUFFIX_FITTED_, "/")

      if (!dir.exists(path_fitted)) {

        dir.create(path_fitted)

      }

    }



    for (model_ in v_models) {


      path_final_model <- paste0(path_special_suffix, "final_model_", model_, "_", TRAINING_SUFFIX, "_", RAND_NO_CID_SMALLEST_LARGEST, "_", MODEL_METRIC, "/")

      if (!dir.exists(path_final_model)) {

        dir.create(path_final_model)

      }

    }

    for (model_ in c("riskscore", "logistic", "xgb")) {


      path_training_fitted <- paste0(path_special_suffix, "fitted_training_", model_, "_", TRAINING_SUFFIX, "_", RAND_NO_CID_SMALLEST_LARGEST, "_", MODEL_METRIC, "/")

      if (!dir.exists(path_training_fitted)) {

        dir.create(path_training_fitted)

      }

    }

    for (model_ in v_models) {


      path_timing <- paste0(path_special_suffix, "timing_", model_, "_", TRAINING_SUFFIX, "_", RAND_NO_CID_SMALLEST_LARGEST, "_", MODEL_METRIC, "/")

      if (!dir.exists(path_timing)) {

        dir.create(path_timing)

      }

    }
    
  }
  
  Create_Folders()
  Remove_Non_Hyperparameters()
  
  Source_And_Remove_Non_Hyperparameters("src/02_ml_pipeline/02_cra_create_consumer_group_table.R")
  Source_And_Remove_Non_Hyperparameters("src/02_ml_pipeline/03_save_training.R")
  Source_And_Remove_Non_Hyperparameters("src/02_ml_pipeline/04_smbinning.R")
}



# LASSO Loop --------------------------------------------------------------

num_cores <- 4
CL <- makeCluster(num_cores)
registerDoParallel(CL)

foreach(i = 1:NUM_MODELS, .packages = c("tidyverse",
                                        "fst",
                                        "tidymodels",
                                        "doParallel",
                                        "embed",
                                        "tictoc",
                                        "lubridate",
                                        "glmnet",
                                        "glmnetUtils",
                                        "readxl"),
        .export = c("SPECIAL_SUFFIX",
                    "CONSUMER_GROUP",
                    "DF_DATA_DICTIONARY"), .verbose = TRUE) %do% {
                                          print(paste("Running model", i))

                      
  TRAINING_START_QTR <- V_TRAINING_START_QTR[i]
  TRAINING_END_QTR <- V_TRAINING_END_QTR[i]
  TEST_START_QTR <- V_TEST_START_QTR[i]
  TEST_END_QTR <- V_TEST_END_QTR[i]

  TRAINING_SUFFIX <- paste0("Train",
                            year(ymd(TRAINING_START_QTR)),
                            "Q", quarter(ymd(TRAINING_START_QTR)),
                            year(ymd(TRAINING_END_QTR)),
                            "Q",
                            quarter(ymd(TRAINING_END_QTR)))

  TEST_SUFFIX <- paste0("Test",
                        year(ymd(TEST_START_QTR)),
                        "Q", quarter(ymd(TEST_START_QTR)),
                        year(ymd(TEST_END_QTR)),
                        "Q", quarter(ymd(TEST_END_QTR)))

  SUFFIX_FITTED_ <- paste0(TRAINING_SUFFIX, "_", TEST_SUFFIX, "_", RAND_NO_CID_SMALLEST_LARGEST, "_", MODEL_METRIC)

  Source_And_Remove_Non_Hyperparameters("src/02_ml_pipeline/05_select_vars_via_LASSO.R")

}

stopCluster(CL)


# XGB Hyperparameter Loop -------------------------------------------------

for(i in 1:NUM_MODELS) {

  print(paste("Running XGB Tuning for model", i))

  TRAINING_START_QTR <- V_TRAINING_START_QTR[i]
  TRAINING_END_QTR <- V_TRAINING_END_QTR[i]
  TEST_START_QTR <- V_TEST_START_QTR[i]
  TEST_END_QTR <- V_TEST_END_QTR[i]

  TRAINING_SUFFIX <- paste0("Train",
                            year(ymd(TRAINING_START_QTR)),
                            "Q", quarter(ymd(TRAINING_START_QTR)),
                            year(ymd(TRAINING_END_QTR)),
                            "Q",
                            quarter(ymd(TRAINING_END_QTR)))

  TEST_SUFFIX <- paste0("Test",
                        year(ymd(TEST_START_QTR)),
                        "Q", quarter(ymd(TEST_START_QTR)),
                        year(ymd(TEST_END_QTR)),
                        "Q", quarter(ymd(TEST_END_QTR)))

  SUFFIX_FITTED_ <- paste0(TRAINING_SUFFIX, "_", TEST_SUFFIX, "_", RAND_NO_CID_SMALLEST_LARGEST, "_", MODEL_METRIC)
  Source_And_Remove_Non_Hyperparameters("src/02_ml_pipeline/06_tune_xgb_hyperparameters.R")


}

# Separately run logistic because of memory problem -------------------------------------------
# Conceptually should be part of the next block

A <- Sys.time()
tic(msg = "Foreach loop")
num_cores <- 8
CL <- makeCluster(num_cores)
registerDoParallel(CL)

foreach(i = 1:NUM_MODELS, .packages = c("tidyverse",
                                        "fst",
                                        "tidymodels",
                                        "doParallel",
                                        "tictoc",
                                        "lubridate",
                                        "logr",
                                        "glmnet",
                                        "glmnetUtils",
                                        "fs"), 
        .export = c("SPECIAL_SUFFIX",
                    "CONSUMER_GROUP",
                    "NUM_MODELS",
                    "MODEL_METRIC",
                    "RAND_NO_CID",
                    "V_POTENTIAL_MODELS"), .verbose = TRUE) %do% {
                      
                      print(paste("Running model", i))
                      
                      TRAINING_START_QTR <- V_TRAINING_START_QTR[i]
                      TRAINING_END_QTR <- V_TRAINING_END_QTR[i]
                      TEST_START_QTR <- V_TEST_START_QTR[i]
                      TEST_END_QTR <- V_TEST_END_QTR[i]
                      
                      TRAINING_SUFFIX <- paste0("Train", 
                                                year(ymd(TRAINING_START_QTR)), 
                                                "Q", quarter(ymd(TRAINING_START_QTR)), 
                                                year(ymd(TRAINING_END_QTR)), 
                                                "Q", 
                                                quarter(ymd(TRAINING_END_QTR)))
                      
                      TEST_SUFFIX <- paste0("Test", 
                                            year(ymd(TEST_START_QTR)), 
                                            "Q", quarter(ymd(TEST_START_QTR)), 
                                            year(ymd(TEST_END_QTR)), 
                                            "Q", quarter(ymd(TEST_END_QTR))) 
                      
                      SUFFIX_FITTED_ <- paste0(TRAINING_SUFFIX, "_", TEST_SUFFIX, "_", RAND_NO_CID_SMALLEST_LARGEST, "_", MODEL_METRIC) 
                      

                      Source_And_Remove_Non_Hyperparameters("src/02_ml_pipeline/07_run_logistic.R")
                      Source_And_Remove_Non_Hyperparameters("src/02_ml_pipeline/08_save_fitted_value_logistic.R")

                      
                      
                    }

stopCluster(CL)
toc()
B <- Sys.time()

# Modeling, Fitted Values, and Merging with Census -------------------------------------------

A <- Sys.time()
tic(msg = "Foreach loop")
num_cores <- 8
CL <- makeCluster(num_cores)
registerDoParallel(CL)

foreach(i = 1:NUM_MODELS, .packages = c("tidyverse",
                                        "fst",
                                        "tidymodels",
                                        "doParallel",
                                        "tictoc",
                                        "lubridate",
                                        "logr",
                                        "glmnet",
                                        "glmnetUtils",
                                        "fs"), 
        .export = c("SPECIAL_SUFFIX",
                    "CONSUMER_GROUP",
                    "NUM_MODELS",
                    "MODEL_METRIC",
                    "RAND_NO_CID",
                    "V_POTENTIAL_MODELS"), .verbose = TRUE) %dopar% {
                      
                      print(paste("Running model", i))
                      
                      TRAINING_START_QTR <- V_TRAINING_START_QTR[i]
                      TRAINING_END_QTR <- V_TRAINING_END_QTR[i]
                      TEST_START_QTR <- V_TEST_START_QTR[i]
                      TEST_END_QTR <- V_TEST_END_QTR[i]
                      
                      TRAINING_SUFFIX <- paste0("Train", 
                                                year(ymd(TRAINING_START_QTR)), 
                                                "Q", quarter(ymd(TRAINING_START_QTR)), 
                                                year(ymd(TRAINING_END_QTR)), 
                                                "Q", 
                                                quarter(ymd(TRAINING_END_QTR)))
                      
                      TEST_SUFFIX <- paste0("Test", 
                                            year(ymd(TEST_START_QTR)), 
                                            "Q", quarter(ymd(TEST_START_QTR)), 
                                            year(ymd(TEST_END_QTR)), 
                                            "Q", quarter(ymd(TEST_END_QTR))) 
                      
                      SUFFIX_FITTED_ <- paste0(TRAINING_SUFFIX, "_", TEST_SUFFIX, "_", RAND_NO_CID_SMALLEST_LARGEST, "_", MODEL_METRIC) 
                      
                      Source_And_Remove_Non_Hyperparameters("src/02_ml_pipeline/09_run_xgb.R")
                      Source_And_Remove_Non_Hyperparameters("src/02_ml_pipeline/10_save_fitted_value_xgb.R")
                      Source_And_Remove_Non_Hyperparameters("src/02_ml_pipeline/11_save_riskscore.R")
                      Source_And_Remove_Non_Hyperparameters("src/02_ml_pipeline/12_merge_fitted_and_census_training.R")
                      Source_And_Remove_Non_Hyperparameters("src/02_ml_pipeline/13_merge_fitted_and_census_test.R")
                      
    
                      
}

stopCluster(CL)
toc()
B <- Sys.time()



Source_And_Remove_Non_Hyperparameters("src/02_ml_pipeline/14_cra_roc_auc_plots_test_cowplot.R")

# Work with Thresholds ----------------------------------------------------

LOOP <- "windows"

tic(msg = "Thresholds loop")
num_cores <- 8
CL <- makeCluster(num_cores)
registerDoParallel(CL)

foreach(i = 1:NUM_MODELS, .packages = c("tidyverse",
                                        "yardstick",
                                        "cowplot",
                                        "tictoc",
                                        "dtplyr",
                                        "ggthemes",
                                        "ggrepel",
                                        "fst",
                                        "doParallel",
                                        "lubridate",
                                        "dtplyr"),
        .export = c("SPECIAL_SUFFIX",
                    "LLH_COND",
                    "CONSUMER_GROUP",
                    "LOOP",
                    "NUM_MODELS",
                    "MODEL_METRIC",
                    "RAND_NO_CID",
                    "V_POTENTIAL_MODELS"), .verbose = TRUE) %dopar% {
                      
                      print(paste("Running model", i))
                      
                      TRAINING_START_QTR <- V_TRAINING_START_QTR[i]
                      TRAINING_END_QTR <- V_TRAINING_END_QTR[i]
                      TEST_START_QTR <- V_TEST_START_QTR[i]
                      TEST_END_QTR <- V_TEST_END_QTR[i]
                      
                      TRAINING_SUFFIX <- paste0("Train", 
                                                year(ymd(TRAINING_START_QTR)), 
                                                "Q", quarter(ymd(TRAINING_START_QTR)), 
                                                year(ymd(TRAINING_END_QTR)), 
                                                "Q", 
                                                quarter(ymd(TRAINING_END_QTR)))
                      
                      TEST_SUFFIX <- paste0("Test", 
                                            year(ymd(TEST_START_QTR)), 
                                            "Q", quarter(ymd(TEST_START_QTR)), 
                                            year(ymd(TEST_END_QTR)), 
                                            "Q", quarter(ymd(TEST_END_QTR))) 
                      
                      SUFFIX_FITTED_ <- paste0(TRAINING_SUFFIX, "_", TEST_SUFFIX, "_", RAND_NO_CID_SMALLEST_LARGEST, "_", MODEL_METRIC) 
                      
                      Source_And_Remove_Non_Hyperparameters("src/03_thresholds_analysis/01_process_outputs.R")

                      path_threshold_inputs <- paste0("../../data/pipeline_outputs/", SPECIAL_SUFFIX,
                                                      "/", "threshold_inputs_", TRAINING_SUFFIX, "_",
                                                      RAND_NO_CID_SMALLEST_LARGEST, "_", MODEL_METRIC, "/")
                      script_name_py <- "python3 src/03_thresholds_analysis/02_generate_thresholds.py"
                      system(paste0(script_name_py, " ", path_threshold_inputs))

                      Source_And_Remove_Non_Hyperparameters("src/03_thresholds_analysis/03_process_data_for_tradeoff_plots.R")
                      Source_And_Remove_Non_Hyperparameters("src/03_thresholds_analysis/04_tpr_fpr_threshold_plots.R")
                      Source_And_Remove_Non_Hyperparameters("src/03_thresholds_analysis/05_tradeoff_plots.R")
                      
                    }
stopCluster(CL)


# Combined loop -----------------------------------------------------------

LOOP <- "combined"

Source_And_Remove_Non_Hyperparameters("src/03_thresholds_analysis/03_process_data_for_tradeoff_plots.R")
Source_And_Remove_Non_Hyperparameters("src/03_thresholds_analysis/05_tradeoff_plots.R")
  